# import sys
#
# print(sys.argv)
# 列表推导式
# list = [i for i in range(1 , 11)]
# print(list)
# list1 = [i**3 for i in range(1 , 11)]
# print(list1)
# list2 = ['hello world' for i in range(5)]
# print(list2)
# list3 = ['name' + str(i) for i in range(1 , 6) ]
# # print(list3)
# # list4 =[i for i in range(1 ,101) if i % 2 != 0]
# # print(list4)
# # list5 = [i for i in range(1 , 100) if i % 2 == 0]
# # print(list5)
# # list6 = [(i, j ) for i in range(1, 3) for j in range(1 , 3)]
# # print(list6)
# import copy
#
# list1 = [1, 12, 15, ['a', 252, 353]]
# list2 = copy.copy(list1)
# print(f'list1:{id(list1)}')
# print(f'list2:{id(list2)}')
# print(f'list1[3]:{id(list1[3])}')
# print(f'list2[3]:{id(list2[3])}')
# print(list2)
# str1 = [1, 12, 15, ['a', 252, 353]]
# str2 = copy.deepcopy(list1)
# print(f'str1:{id(str1)}')
# print(f'str2:{id(str2)}')
# print(f'str2[3]:{id(str2[3])}')
# print(f'str1[3]:{id(str1[3])}')
# def wrapper(fn):
#     def inner():
#         print('开始时间')
#         fn()
#         print('结束时间')
#     return  inner
# def fn1():
#     print(123)
# def fn2():
#     print(345)
# fn1 = wrapper(fn1)
# fn1()
# fn2 = wrapper(fn2)
# # fn2()
# def decorator(fn):
#     def inner():
#         print('前面添加功能')
#         fn()
#         print('后面添加功能')
#     return  inner
# def fn1():
#     print('fn1')
# def fn2():
#     print('fn2')
# fn1 = decorator(fn1)
# fn1()
# fn2 = decorator(fn2)
# # fn2()
# def decorator(fn):
#     def inner(num1,num2):
#         print('运算中')
#         return fn(num1, num2)
#     return  inner
# @decorator
# def add(num1, num2):
#     return num1 + num2
# if __name__ == '__main__':
#     print(add(88, 99))
import time
def decorator(fn):
    def inner(*args, **kwargs):
        start = time.time()
        result = fn(*args, **kwargs)
        end = time.time()
        print(f'程序运行的时间: {end - start}')
        return result
    return inner
@decorator
def fn1(frequency):
    for i in range(frequency):
        print(i)
if __name__ == '__main__':
    fn1(100000)